(global.webpackJsonp = global.webpackJsonp || []).push([ [ "question/order/index" ], {
    1285: function(e, o, r) {
        r.r(o);
        var i = r("bfc2"), t = r.n(i);
        for (var n in i) "default" !== n && function(e) {
            r.d(o, e, function() {
                return i[e];
            });
        }(n);
        o.default = t.a;
    },
    "214c": function(e, o, r) {
        (function(e) {
            r("1067"), i(r("66fd"));
            var o = i(r("cfa7"));
            function i(e) {
                return e && e.__esModule ? e : {
                    default: e
                };
            }
            wx.__webpack_require_UNI_MP_PLUGIN__ = r, e(o.default);
        }).call(this, r("543d").createPage);
    },
    "25a7": function(e, o, r) {
        var i = r("87ff");
        r.n(i).a;
    },
    "87ff": function(e, o, r) {},
    bfc2: function(e, o, r) {
        (function(e) {
            Object.defineProperty(o, "__esModule", {
                value: !0
            }), o.default = void 0;
            var i, t = r("26cb"), n = (function(e) {
                e && e.__esModule;
            }(r("03b8")), r("7a6d"), r("db8f")), c = r("9b04"), s = r("9b63"), u = r("871c"), f = r("a71e"), a = r("0cc1"), d = r("8434"), p = r("7960"), _ = r("4771");
            function h(e, o) {
                var r = Object.keys(e);
                if (Object.getOwnPropertySymbols) {
                    var i = Object.getOwnPropertySymbols(e);
                    o && (i = i.filter(function(o) {
                        return Object.getOwnPropertyDescriptor(e, o).enumerable;
                    })), r.push.apply(r, i);
                }
                return r;
            }
            function l(e) {
                for (var o = 1; o < arguments.length; o++) {
                    var r = null != arguments[o] ? arguments[o] : {};
                    o % 2 ? h(Object(r), !0).forEach(function(o) {
                        m(e, o, r[o]);
                    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : h(Object(r)).forEach(function(o) {
                        Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(r, o));
                    });
                }
                return e;
            }
            function m(e, o, r) {
                return o in e ? Object.defineProperty(e, o, {
                    value: r,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }) : e[o] = r, e;
            }
            var y = "", b = (i = {
                components: {
                    kpForm: function() {
                        Promise.all([ r.e("common/vendor"), r.e("components/kp-form/kp-form") ]).then(function() {
                            return resolve(r("b1b0"));
                        }.bind(null, r)).catch(r.oe);
                    }
                },
                data: function() {
                    var e;
                    return {
                        course: (e = {
                            title: "",
                            price: "",
                            term_type: ""
                        }, m(e, "price", ""), m(e, "id", ""), m(e, "is_form", 0), m(e, "form_id", ""), m(e, "img", ""), 
                        m(e, "price_type", ""), e),
                        user_id: "",
                        isChooseImg: !1,
                        form: [],
                        payData: {},
                        isPay: -1,
                        formShow: !1,
                        isShow: !1,
                        show: !1,
                        time_limit: "",
                        froms: "",
                        coupon: "请选择优惠券",
                        choiceCouponId: "",
                        isShowCoupon: !1,
                        total_price: "",
                        isVip: ""
                    };
                },
                computed: l({}, (0, t.mapGetters)([ "configs", "user", "mainColor", "iphoneXStyle", "isIphone", "priceColor" ])),
                created: function() {},
                onShow: function() {
                    var o = this;
                    e.getStorage({
                        key: "couponUrl",
                        success: function(e) {
                            (0, f.isEmpty)(e.data) || (o.choiceCouponId = JSON.parse(e.data).id, o.totalPrice());
                        }
                    });
                },
                onUnload: function() {
                    e.removeStorage({
                        key: "couponUrl",
                        success: function(e) {}
                    });
                },
                onHide: function() {
                    e.removeStorage({
                        key: "couponUrl",
                        success: function(e) {}
                    });
                },
                mounted: function() {
                    var e = this;
                    y = this, (0, _.getStorageSync)("userInfo").then(function(o) {
                        var r = JSON.parse(o.data);
                        (0, f.isEmpty)(r.id) || (e.user_id = r.id), e.getDetail();
                    }, function(o) {
                        e.getDetail();
                    });
                },
                onLoad: function(e) {
                    var o = this;
                    this.course.id = e.id, o.froms = e.froms || "", o.course_id = e.course_id || "", 
                    o.isVip = "true" == e.isVip, 1 != e.price_type && o.isPayType();
                }
            }, m(i, "computed", l({}, (0, t.mapGetters)([ "configs", "user", "mainColor", "iphoneXStyle", "isIphone" ]))), 
            m(i, "methods", {
                totalPrice: function() {
                    var e = this, o = {
                        type: 2,
                        product_id: this.course.id,
                        user_coupon_id: this.choiceCouponId
                    };
                    (0, u.afterCoupon)(o).then(function(o) {
                        e.course.price = parseFloat(o.price) < 0 ? 0 : o.price, e.coupon = "减" + o.coupon_price + "元";
                    });
                },
                chooseCoupon: function() {
                    var e = this;
                    (0, p.h5JudgeLogin)(2).then(function(o) {
                        o || (0, d.route)({
                            url: "/coupon/list",
                            type: 1,
                            data: {
                                useType: 2,
                                product_id: e.course.id,
                                type: 2
                            }
                        });
                    });
                },
                isPayType: function() {
                    var e = this;
                    (0, c.payMethod)().then(function(o) {
                        -1 == o.indexOf("wxpay") && (e.isPay = 0);
                    });
                },
                getDetail: function() {
                    var e = this, o = {
                        id: this.course.id,
                        user_id: e.user_id,
                        isLoading: !0
                    };
                    (0, s.paperInfo)(o).then(function(o) {
                        e.course = o, e.total_price = o.price, 2 == e.course.time_limit_type && (e.time_limit = e.course.time_limit + "分钟"), 
                        1 == o.is_form ? e.formShow = !0 : e.formShow = !1, o.is_form && e.$nextTick(function() {
                            e.$refs.formOrder.getForm(e.course.form_id, 3);
                        }), e.isShow = !0, 1 == e.course.is_alone_sale && 1 == e.course.price_type && !e.course.is_buy || 1 == e.froms && !e.course.is_buy || e.isVip && 1 == e.course.vip_free_see && !e.course.is_buy || -1 == e.configs.coupon_set.indexOf("paper") ? e.isShowCoupon = !1 : e.isShowCoupon = !0;
                    });
                },
                checks: function() {
                    this.$refs.formOrder.Order();
                },
                chooseImgs: function(e) {
                    this.isChooseImg = e;
                },
                choosePay: function(e) {
                    this.isPay = 1 == e.typeId ? 3 : 2, this.Order();
                },
                Orders: function(e) {
                    var o = this;
                    o.form = e, 1 == o.course.price_type && !o.course.is_buy || 1 == o.froms || o.isVip && 1 == o.course.vip_free_see && !o.course.is_buy ? o.freeOrder() : o.Order();
                },
                freeOrder: function() {
                    var e, o = this;
                    e = 1 == o.froms ? 9 : o.isVip && 1 == o.course.vip_free_see ? 5 : 4;
                    var r = {
                        paper_id: this.course.id,
                        course_id: this.course_id,
                        is_form: this.course.is_form,
                        form_data: this.form,
                        form_id: this.course.form_id,
                        payType: e,
                        order_id: ""
                    };
                    (0, s.subPaperOrder)(r).then(function(e) {
                        (0, d.route)({
                            url: "/question/paper/index",
                            type: 3,
                            data: {
                                id: o.course.id
                            }
                        });
                    });
                },
                Order: function() {
                    var e = this;
                    if (0 == e.isPay) return e.$toast("未设置支付方式", "none"), !1;
                    var o = {
                        paper_id: this.course.id,
                        course_id: this.course_id,
                        is_form: this.course.is_form,
                        form_data: this.form,
                        form_id: this.course.form_id,
                        use_user_coupon_id: this.choiceCouponId,
                        payType: 1
                    };
                    e.show = !0, (0, s.subPaperOrder)(o).then(function(o) {
                        e.show = !1, (0, a.pay)(o, e.orderSuccess, e.orderFail, "");
                    });
                },
                orderSuccess: function(e) {
                    (0, d.route)({
                        url: "/question/paper/index",
                        type: 3,
                        data: {
                            id: this.course.id
                        }
                    });
                },
                orderFail: function(e) {
                    console.log("失败啦!");
                },
                putOrder: (0, n.throttle)(function() {
                    1 == y.course.is_form ? y.$refs.formOrder.check() : 1 == y.course.price_type && !y.course.is_buy || 1 == y.froms || y.isVip && 1 == y.course.vip_free_see && !y.course.is_buy ? y.freeOrder() : y.Order();
                }, 1500)
            }), i);
            o.default = b;
        }).call(this, r("543d").default);
    },
    cfa7: function(e, o, r) {
        r.r(o);
        var i = r("ddab"), t = r("1285");
        for (var n in t) "default" !== n && function(e) {
            r.d(o, e, function() {
                return t[e];
            });
        }(n);
        r("25a7");
        var c = r("f0c5"), s = Object(c.a)(t.default, i.b, i.c, !1, null, "186ff53d", null, !1, i.a, void 0);
        o.default = s.exports;
    },
    ddab: function(e, o, r) {
        r.d(o, "b", function() {
            return i;
        }), r.d(o, "c", function() {
            return t;
        }), r.d(o, "a", function() {});
        var i = function() {
            this.$createElement;
            this._self._c;
        }, t = [];
    }
}, [ [ "214c", "common/runtime", "common/vendor" ] ] ]);